<template>
    <div>
        <swiper>
            <swiper-item v-for="item in banners">
                <a :href="item.link">
                <img :src="item.image" alt="" @load="imageLoad">
                </a>
            </swiper-item>
        </swiper>
    </div>
</template>

<script>
import {Swiper, SwiperItem} from 'components/common/swiper'

export default {
    name: 'MogujieHomeswiper',
    props: {
        banners: {
            types: Array,
            default() {
                return []
            }
        }
    },
    data() {
        return {
            isLoad: false
        }
    },
    components: {
        Swiper,
        SwiperItem
    },
    methods: {
        imageLoad() {
            if(!this.isLoad) {
                //把监听轮播图篇加载完成事件发送到Home中
                this.$emit('swiperImageLoad')
                this.isLoad = true
                // 让事件只发出去一次 虽然有四张轮播图 
                // 但是高度是一样的
            }
           
        }
    }
    

   
};
</script>

<style scoped>

</style>